//
//  GTTableView.m
//  GiftTalk
//
//  Created by Wan on 16/4/8.
//  Copyright © 2016年 Wan. All rights reserved.
//

#import "GTTableView.h"
#import <UIKit/UIKit.h>

@implementation GTTableView

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    if (self = [super initWithFrame:frame style:style]) {

        self.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        // 是否延迟响应/能否取消 触摸事件
        self.delaysContentTouches = false;
        self.canCancelContentTouches = true;
        
        UIView *wrapView = self.subviews.firstObject;
        
        if (wrapView != nil && [NSStringFromClass([wrapView classForCoder]) hasPrefix:@"WrapperView"]) {
            for (UIGestureRecognizer * gesture in wrapView.gestureRecognizers) {
                
                if ([NSStringFromClass([wrapView classForCoder]) containsString:@"DelayedTouchesBegan"]) {
                    gesture.enabled = false;
                    break;
                }
            }
        }
    }
    
    return self;
}


- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
    if ([view isKindOfClass:[UIControl class]]) {
        return true;
    }
    
    return [super touchesShouldCancelInContentView:view];
}

@end
